package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum MemberLevelCode {
	
	ZERO(0,"0级"),
	STAIR(1,"一级"),
	SECOND(2,"二级"),
	THREE(3,"三级"),
	FOUR(4,"四级"),
	FIVE(5,"五级"),
	SIX(6,"六级");
	
	private Integer value;
	private String text;

	private MemberLevelCode(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static MemberLevelCode toCode(Integer value) {
		if (ZERO.value == value) {
			return ZERO;
		}else if (STAIR.value == value) {
			return STAIR;
		} else if (SECOND.value == value) {
			return SECOND;
		}else if (THREE.value == value) {
			return THREE;
		}else if (FOUR.value == value) {
			return FOUR;
		}else if (FIVE.value == value) {
			return FIVE;
		}else if (SIX.value == value) {
			return SIX;
		}else {
			throw new InvalidArgumentException("Unknown MemberLevelCode[" + value + "].");
		}
	}
}
